package com.yihu.cms.action;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.yihu.beans.ResultVO;
import com.yihu.beans.WaterfallCondition;
import com.yihu.beans.WaterfallPage;
import com.yihu.cms.service.WaterfallService;

@Controller
public class WaterfallAction extends BaseController{

	private WaterfallService ws = new WaterfallService();
	@RequestMapping(value="/waterfall/search", method = RequestMethod.GET)
	public @ResponseBody Object waterfall(WaterfallCondition fc) {
		
		String json = ws.getWaterfallPaging(fc);
		return JSON.parseObject(json, WaterfallPage.class);
	}
	
	@RequestMapping(value="/waterfall/like", method = RequestMethod.PUT)
	public @ResponseBody Object like(@RequestBody  WaterfallCondition fc) {
		ResultVO result = ws.waterfallLike(fc);
		return JSON.toJSONString(result);
	}
	
	@RequestMapping(value="/waterfall/follow", method = RequestMethod.PUT)
	public @ResponseBody Object follow(@RequestBody WaterfallCondition fc) {
		ResultVO result = ws.waterfallFollow(fc);
		return JSON.toJSONString(result);
	}
}
